//
//  BBScrollImageView.h
//  ImageScrollView
//
//  Created by box on 13-12-17.
//  Copyright (c) 2013年 box. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "BBPageControl.h"

@protocol BBScrollImageViewDelegate ,BBScrollImageViewDataSource;
@interface BBScrollImageView : UIView

@property (retain, nonatomic) BBPageControl *pageControl;

@property (retain, nonatomic) IBOutlet UILabel *titleLbl;

//容纳titleLbl和numberLbl
@property (retain, nonatomic) IBOutlet UIView *titleContentView;

//图片数量超过这个值不用pageControl 而用“1/10”类型表示 默认:5
@property(nonatomic,assign)CGFloat pageControlLimit;

//显示pageControl或者“2/10”标识 为NO 都不显示 YES：根据pageControlLimit值选择显示其中之一
@property(nonatomic,assign)BOOL showIndicator;

//动画时间 默认：0.8
@property(nonatomic,assign)CGFloat animateDuration;

//自动滚动播放 默认：NO
@property(nonatomic,assign)BOOL autoPlay;

//点击图片时显示全屏大图  默认：NO
@property(nonatomic,assign)BOOL showFullImageWhenClick;

//自动播放时间间隔 默认：3.0
@property(nonatomic,assign)CGFloat autoPlayDuration;

//当前可见的ImageView
@property(nonatomic,readonly)UIImageView *visibleImageView;

//当前已加载到url索引
@property(nonatomic,readonly)NSInteger urlIndex;

//url数量
@property (nonatomic,assign)NSInteger count;

@property(nonatomic,assign)id<BBScrollImageViewDelegate>delegate;
@property(nonatomic,assign)id<BBScrollImageViewDataSource>dataSource;

- (void)reloadData;
- (BOOL)skipToNextImage;
- (BOOL)skipToLastImage;

/*!获取在指定index的image，获取出来的图片在代理方法
 * - (void)scrollImageView:(BBScrollImageView *)aScrollImageView didGetImage:(UIImage *)aImage atIndex:(NSInteger)aIndex;
 * 中取
 */
- (void)getImageAtIndex:(NSInteger)aIndex;

+ (instancetype)scrollImageViewWithFrame:(CGRect)frame;

@end



@protocol BBScrollImageViewDataSource <NSObject>

@optional
- (NSString *)scrollImageView:(BBScrollImageView *)aScrollImageView titleAtIndex:(NSInteger)aIndex;
@required
- (NSInteger)numberOfImagesInScrollImageView:(BBScrollImageView *)aScrollImageView;
- (NSURL *)scrollImageView:(BBScrollImageView *)aScrollImageView imageUrlAtIndex:(NSInteger)aIndex;

@end


@protocol BBScrollImageViewDelegate <NSObject>

@optional
- (void)scrollImageView:(BBScrollImageView *)aScrollImageView didSeletedImageView:(UIImageView *)imageView atIndex:(NSInteger)aIndex;

- (void)scrollImageView:(BBScrollImageView *)aScrollImageView didScrollToIndex:(NSInteger)aIndex;

//- (void)getImageAtIndex:(NSInteger)aIndex;的代理回调
- (void)scrollImageView:(BBScrollImageView *)aScrollImageView didGetImage:(UIImage *)aImage atIndex:(NSInteger)aIndex;
- (void)scrollImageView:(BBScrollImageView *)aScrollImageView failedToGetImageAtIndex:(NSInteger)aIndex;

@end
